package com.webapp.domain.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;
import com.webapp.domain.util.Global;

/**
 * 纠纷咨询附件
 * @author zern
 *
 */
@Entity
@Table(name = "attachment")
public class Attachment extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1149725308995412185L;

	private Long id;
	
	private String type;		// 附件类型
	
	private String url;			// 附件地址
	
	private String delFlag = Global.NOTDELETE;	// 0是正常，1 是已删除
	
	private DisputesData disputesData;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "id")
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "type", length = 10)
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "url", length = 100)
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "disputes_data_id",referencedColumnName = "id")
	@JSONField(serialize = false)
	public DisputesData getDisputesData() {
		return disputesData;
	}

	public void setDisputesData(DisputesData disputesData) {
		this.disputesData = disputesData;
	}

	@Column(name = "del_flag", length = 2)
	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}
	
}
